﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;

namespace LinQModel.Entities
{
    [Table(Name = "Teacher")]
    public class Teacher : IDataErrorInfo
    {
        [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
        public string TeacherID { get; set; }

        [Column]
        public string TeacherName { get; set; }

        public string this[string propName]
        {
            get
            {
                if ((propName == "TeacherID") && string.IsNullOrEmpty(TeacherID))
                    return "Please enter a teacher ID";
                if ((propName == "TeacherName") && string.IsNullOrEmpty(TeacherName))
                    return "Please enter a teacher name";
                return null;
            }
        }

        public string Error { get { return null; } } // Not required
    }
}
